package top.eggcode.plugins.office.pattern;

import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import top.eggcode.plugins.office.ExcelRender;

import java.util.Map;

/**
 * Excel 数据拆分模式
 */
public class ExcelTemplate {
    /**
     * 申请情况统计表
     *
     * @param workbook 工作簿
     * @param props    数据集合
     */
    public static void applyStatisticalForm(ExcelRender excelRender, XSSFWorkbook workbook, Map<String, String> props) {
        // 0 表示根据索引获取第一张工作表
        XSSFSheet sheet = workbook.getSheetAt(0);
        props.forEach((addressCode, cellContent) -> excelRender.toCellOfInt(sheet, addressCode, Integer.parseInt(cellContent)));
    }
}
